// get 请求

var http = require('http');
var util = require('util');
var url = require('url');

http.createServer(function(req,res){

  res.writeHead(200,{
    'Content-Type':'text/plain;charset=utf-8'
  });
  // console.log(req);
  // res.end('xxx 大赛');
  var urlObj = url.parse(req.url);
// Url {
//   protocol: null,
//   slashes: null,
//   auth: null,
//   host: null,
//   port: null,
//   hostname: null,
//   hash: null,
//   search: '?d=%E6%97%B6%E4%BB%A3',
//   query: 'd=%E6%97%B6%E4%BB%A3',
//   pathname: '/sd',
//   path: '/sd?d=%E6%97%B6%E4%BB%A3',
//   href: '/sd?d=%E6%97%B6%E4%BB%A3'
// }
  // res.end(util.inspect(urlObj));
  // res.end(req.url);

  var _param = url.parse(req.url,true).query;
  res.write("姓名: " + _param.name + "\n");
  res.write("age: " + _param.age + "\n");
  res.end();

}).listen(5642);

console.log('5642 is listening');